Description (copied from assignment)
Background & Context
The Thera bank recently saw a steep decline in the number of users of their credit card, credit cards are a good source of income for banks because of different kinds of fees charged by the banks like annual fees, balance transfer fees, and cash advance fees, late payment fees, foreign transaction fees, and others. Some fees are charged to every user irrespective of usage, while others are charged under specified circumstances.
Customers’ leaving credit cards services would lead bank to loss, so the bank wants to analyze the data of customers and identify the customers who will leave their credit card services and reason for same – so that bank could improve upon those areas
You as a Data scientist at Thera bank need to come up with a classification model that will help the bank improve its services so that customers do not renounce their credit cards
You need to identify the best possible model that will give the required performance
Objective
Data Dictionary:
# Library to suppress warnings or deprecation notes
import warnings
warnings.filterwarnings("ignore")
# Import time to check the training time
import time
import datetime
# Libraries to help with reading and manipulating data
import numpy as np
import pandas as pd
# Libraries to help with data visualization
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
# Libraries to split data, impute missing values
from sklearn.model_selection import train_test_split
from sklearn.impute import SimpleImputer
# To help with model building
from sklearn.linear_model import LogisticRegression
# Libraries to import decision tree classifier and different ensemble classifiers
from sklearn.ensemble import BaggingClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import AdaBoostClassifier, GradientBoostingClassifier
from xgboost import XGBClassifier
from sklearn.ensemble import StackingClassifier
from sklearn.tree import DecisionTreeClassifier
# Libtune to tune model, get different metric scores
from sklearn import metrics
from sklearn.metrics import (
confusion_matrix,
classification_report,
accuracy_score,
precision_score,
recall_score,
f1_score,
roc_auc_score,
plot_confusion_matrix,
)
# To be used for data scaling and one hot encoding
from sklearn.preprocessing import StandardScaler, MinMaxScaler, OneHotEncoder
# To be used for tuning the model
from sklearn.model_selection import (
GridSearchCV,
RandomizedSearchCV,
StratifiedKFold,
cross_val_score,
)
# To be used for creating pipelines and personalizing them
from sklearn.pipeline import Pipeline
from sklearn.compose import ColumnTransformer
# To oversample and undersample data
from imblearn.over_sampling import SMOTE
from imblearn.under_sampling import RandomUnderSampler
# to make Python code more structured
%load_ext nb_black
# To supress scientific notations for a dataframe
pd.set_option("display.float_format", lambda x: "%.3f" % x)
# Remove limit from displayed columns and rows.
pd.set_option("display.max_columns", None)
pd.set_option("display.max_rows", 200)
# load the data into pandas dataframe
bank = pd.read_csv("BankChurners.csv")
bank.head(10)
| CLIENTNUM | Attrition_Flag | Customer_Age | Gender | Dependent_count | Education_Level | Marital_Status | Income_Category | Card_Category | Months_on_book | Total_Relationship_Count | Months_Inactive_12_mon | Contacts_Count_12_mon | Credit_Limit | Total_Revolving_Bal | Avg_Open_To_Buy | Total_Amt_Chng_Q4_Q1 | Total_Trans_Amt | Total_Trans_Ct | Total_Ct_Chng_Q4_Q1 | Avg_Utilization_Ratio | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 768805383 | Existing Customer | 45 | M | 3 | High School | Married | $60K - $80K | Blue | 39 | 5 | 1 | 3 | 12691.000 | 777 | 11914.000 | 1.335 | 1144 | 42 | 1.625 | 0.061 |
| 1 | 818770008 | Existing Customer | 49 | F | 5 | Graduate | Single | Less than $40K | Blue | 44 | 6 | 1 | 2 | 8256.000 | 864 | 7392.000 | 1.541 | 1291 | 33 | 3.714 | 0.105 |
| 2 | 713982108 | Existing Customer | 51 | M | 3 | Graduate | Married | $80K - $120K | Blue | 36 | 4 | 1 | 0 | 3418.000 | 0 | 3418.000 | 2.594 | 1887 | 20 | 2.333 | 0.000 |
| 3 | 769911858 | Existing Customer | 40 | F | 4 | High School | NaN | Less than $40K | Blue | 34 | 3 | 4 | 1 | 3313.000 | 2517 | 796.000 | 1.405 | 1171 | 20 | 2.333 | 0.760 |
| 4 | 709106358 | Existing Customer | 40 | M | 3 | Uneducated | Married | $60K - $80K | Blue | 21 | 5 | 1 | 0 | 4716.000 | 0 | 4716.000 | 2.175 | 816 | 28 | 2.500 | 0.000 |
| 5 | 713061558 | Existing Customer | 44 | M | 2 | Graduate | Married | $40K - $60K | Blue | 36 | 3 | 1 | 2 | 4010.000 | 1247 | 2763.000 | 1.376 | 1088 | 24 | 0.846 | 0.311 |
| 6 | 810347208 | Existing Customer | 51 | M | 4 | NaN | Married | $120K + | Gold | 46 | 6 | 1 | 3 | 34516.000 | 2264 | 32252.000 | 1.975 | 1330 | 31 | 0.722 | 0.066 |
| 7 | 818906208 | Existing Customer | 32 | M | 0 | High School | NaN | $60K - $80K | Silver | 27 | 2 | 2 | 2 | 29081.000 | 1396 | 27685.000 | 2.204 | 1538 | 36 | 0.714 | 0.048 |
| 8 | 710930508 | Existing Customer | 37 | M | 3 | Uneducated | Single | $60K - $80K | Blue | 36 | 5 | 2 | 0 | 22352.000 | 2517 | 19835.000 | 3.355 | 1350 | 24 | 1.182 | 0.113 |
| 9 | 719661558 | Existing Customer | 48 | M | 2 | Graduate | Single | $80K - $120K | Blue | 36 | 6 | 3 | 3 | 11656.000 | 1677 | 9979.000 | 1.524 | 1441 | 32 | 0.882 | 0.144 |
bank.tail(10)
| CLIENTNUM | Attrition_Flag | Customer_Age | Gender | Dependent_count | Education_Level | Marital_Status | Income_Category | Card_Category | Months_on_book | Total_Relationship_Count | Months_Inactive_12_mon | Contacts_Count_12_mon | Credit_Limit | Total_Revolving_Bal | Avg_Open_To_Buy | Total_Amt_Chng_Q4_Q1 | Total_Trans_Amt | Total_Trans_Ct | Total_Ct_Chng_Q4_Q1 | Avg_Utilization_Ratio | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 10117 | 712503408 | Existing Customer | 57 | M | 2 | Graduate | Married | $80K - $120K | Blue | 40 | 6 | 3 | 4 | 17925.000 | 1909 | 16016.000 | 0.712 | 17498 | 111 | 0.820 | 0.106 |
| 10118 | 713755458 | Attrited Customer | 50 | M | 1 | NaN | NaN | $80K - $120K | Blue | 36 | 6 | 3 | 4 | 9959.000 | 952 | 9007.000 | 0.825 | 10310 | 63 | 1.100 | 0.096 |
| 10119 | 716893683 | Attrited Customer | 55 | F | 3 | Uneducated | Single | abc | Blue | 47 | 4 | 3 | 3 | 14657.000 | 2517 | 12140.000 | 0.166 | 6009 | 53 | 0.514 | 0.172 |
| 10120 | 710841183 | Existing Customer | 54 | M | 1 | High School | Single | $60K - $80K | Blue | 34 | 5 | 2 | 0 | 13940.000 | 2109 | 11831.000 | 0.660 | 15577 | 114 | 0.754 | 0.151 |
| 10121 | 713899383 | Existing Customer | 56 | F | 1 | Graduate | Single | Less than $40K | Blue | 50 | 4 | 1 | 4 | 3688.000 | 606 | 3082.000 | 0.570 | 14596 | 120 | 0.791 | 0.164 |
| 10122 | 772366833 | Existing Customer | 50 | M | 2 | Graduate | Single | $40K - $60K | Blue | 40 | 3 | 2 | 3 | 4003.000 | 1851 | 2152.000 | 0.703 | 15476 | 117 | 0.857 | 0.462 |
| 10123 | 710638233 | Attrited Customer | 41 | M | 2 | NaN | Divorced | $40K - $60K | Blue | 25 | 4 | 2 | 3 | 4277.000 | 2186 | 2091.000 | 0.804 | 8764 | 69 | 0.683 | 0.511 |
| 10124 | 716506083 | Attrited Customer | 44 | F | 1 | High School | Married | Less than $40K | Blue | 36 | 5 | 3 | 4 | 5409.000 | 0 | 5409.000 | 0.819 | 10291 | 60 | 0.818 | 0.000 |
| 10125 | 717406983 | Attrited Customer | 30 | M | 2 | Graduate | NaN | $40K - $60K | Blue | 36 | 4 | 3 | 3 | 5281.000 | 0 | 5281.000 | 0.535 | 8395 | 62 | 0.722 | 0.000 |
| 10126 | 714337233 | Attrited Customer | 43 | F | 2 | Graduate | Married | Less than $40K | Silver | 25 | 6 | 2 | 4 | 10388.000 | 1961 | 8427.000 | 0.703 | 10294 | 61 | 0.649 | 0.189 |
np.random.seed(1)
bank.sample(n=10)
| CLIENTNUM | Attrition_Flag | Customer_Age | Gender | Dependent_count | Education_Level | Marital_Status | Income_Category | Card_Category | Months_on_book | Total_Relationship_Count | Months_Inactive_12_mon | Contacts_Count_12_mon | Credit_Limit | Total_Revolving_Bal | Avg_Open_To_Buy | Total_Amt_Chng_Q4_Q1 | Total_Trans_Amt | Total_Trans_Ct | Total_Ct_Chng_Q4_Q1 | Avg_Utilization_Ratio | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 6498 | 712389108 | Existing Customer | 43 | F | 2 | Graduate | Married | Less than $40K | Blue | 36 | 6 | 3 | 2 | 2570.000 | 2107 | 463.000 | 0.651 | 4058 | 83 | 0.766 | 0.820 |
| 9013 | 718388733 | Existing Customer | 38 | F | 1 | College | NaN | Less than $40K | Blue | 32 | 2 | 3 | 3 | 2609.000 | 1259 | 1350.000 | 0.871 | 8677 | 96 | 0.627 | 0.483 |
| 2053 | 710109633 | Existing Customer | 39 | M | 2 | College | Married | $60K - $80K | Blue | 31 | 6 | 3 | 2 | 9871.000 | 1061 | 8810.000 | 0.545 | 1683 | 34 | 0.478 | 0.107 |
| 3211 | 717331758 | Existing Customer | 44 | M | 4 | Graduate | Married | $120K + | Blue | 32 | 6 | 3 | 4 | 34516.000 | 2517 | 31999.000 | 0.765 | 4228 | 83 | 0.596 | 0.073 |
| 5559 | 709460883 | Attrited Customer | 38 | F | 2 | Doctorate | Married | Less than $40K | Blue | 28 | 5 | 2 | 4 | 1614.000 | 0 | 1614.000 | 0.609 | 2437 | 46 | 0.438 | 0.000 |
| 6106 | 789105183 | Existing Customer | 54 | M | 3 | Post-Graduate | Single | $80K - $120K | Silver | 42 | 3 | 1 | 2 | 34516.000 | 2488 | 32028.000 | 0.552 | 4401 | 87 | 0.776 | 0.072 |
| 4150 | 771342183 | Attrited Customer | 53 | F | 3 | Graduate | Single | $40K - $60K | Blue | 40 | 6 | 3 | 2 | 1625.000 | 0 | 1625.000 | 0.689 | 2314 | 43 | 0.433 | 0.000 |
| 2205 | 708174708 | Existing Customer | 38 | M | 4 | Graduate | Married | $40K - $60K | Blue | 27 | 6 | 2 | 4 | 5535.000 | 1276 | 4259.000 | 0.636 | 1764 | 38 | 0.900 | 0.231 |
| 4145 | 718076733 | Existing Customer | 43 | M | 1 | Graduate | Single | $60K - $80K | Silver | 31 | 4 | 3 | 3 | 25824.000 | 1170 | 24654.000 | 0.684 | 3101 | 73 | 0.780 | 0.045 |
| 5324 | 821889858 | Attrited Customer | 50 | F | 1 | Doctorate | Single | abc | Blue | 46 | 6 | 4 | 3 | 1970.000 | 1477 | 493.000 | 0.662 | 2493 | 44 | 0.571 | 0.750 |
bank.shape
(10127, 21)
bank.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 10127 entries, 0 to 10126 Data columns (total 21 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 CLIENTNUM 10127 non-null int64 1 Attrition_Flag 10127 non-null object 2 Customer_Age 10127 non-null int64 3 Gender 10127 non-null object 4 Dependent_count 10127 non-null int64 5 Education_Level 8608 non-null object 6 Marital_Status 9378 non-null object 7 Income_Category 10127 non-null object 8 Card_Category 10127 non-null object 9 Months_on_book 10127 non-null int64 10 Total_Relationship_Count 10127 non-null int64 11 Months_Inactive_12_mon 10127 non-null int64 12 Contacts_Count_12_mon 10127 non-null int64 13 Credit_Limit 10127 non-null float64 14 Total_Revolving_Bal 10127 non-null int64 15 Avg_Open_To_Buy 10127 non-null float64 16 Total_Amt_Chng_Q4_Q1 10127 non-null float64 17 Total_Trans_Amt 10127 non-null int64 18 Total_Trans_Ct 10127 non-null int64 19 Total_Ct_Chng_Q4_Q1 10127 non-null float64 20 Avg_Utilization_Ratio 10127 non-null float64 dtypes: float64(5), int64(10), object(6) memory usage: 1.6+ MB
Observations:
bank.duplicated().sum()
0
# Used CLIENTNUM to make sure there were no duplicate records
# Since there are no duplicate records, I can now drop CLIENTNUM
bank.drop(["CLIENTNUM"], axis=1, inplace=True)
## 2.5 - Check values for soon-to-be categorical variables to ensure nothing needs correction
bank["Attrition_Flag"].value_counts()
Existing Customer 8500 Attrited Customer 1627 Name: Attrition_Flag, dtype: int64
bank["Gender"].value_counts()
F 5358 M 4769 Name: Gender, dtype: int64
bank["Education_Level"].value_counts()
Graduate 3128 High School 2013 Uneducated 1487 College 1013 Post-Graduate 516 Doctorate 451 Name: Education_Level, dtype: int64
bank["Marital_Status"].value_counts()
Married 4687 Single 3943 Divorced 748 Name: Marital_Status, dtype: int64
bank["Income_Category"].value_counts()
Less than $40K 3561 $40K - $60K 1790 $80K - $120K 1535 $60K - $80K 1402 abc 1112 $120K + 727 Name: Income_Category, dtype: int64
# abc seems to be filler for missing values - will replace with "missing"
bank["Income_Category"] = np.where(
(bank.Income_Category == "abc"), "missing", bank.Income_Category
)
bank["Income_Category"].value_counts()
Less than $40K 3561 $40K - $60K 1790 $80K - $120K 1535 $60K - $80K 1402 missing 1112 $120K + 727 Name: Income_Category, dtype: int64
bank["Card_Category"].value_counts()
Blue 9436 Silver 555 Gold 116 Platinum 20 Name: Card_Category, dtype: int64
bank["Attrition_Flag"] = bank["Attrition_Flag"].astype("category")
bank["Gender"] = bank["Gender"].astype("category")
bank["Education_Level"] = bank["Education_Level"].astype("category")
bank["Marital_Status"] = bank["Marital_Status"].astype("category")
bank["Income_Category"] = bank["Income_Category"].astype("category")
bank["Card_Category"] = bank["Card_Category"].astype("category")
bank.describe(include="all").T
| count | unique | top | freq | mean | std | min | 25% | 50% | 75% | max | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Attrition_Flag | 10127 | 2 | Existing Customer | 8500 | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| Customer_Age | 10127.000 | NaN | NaN | NaN | 46.326 | 8.017 | 26.000 | 41.000 | 46.000 | 52.000 | 73.000 |
| Gender | 10127 | 2 | F | 5358 | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| Dependent_count | 10127.000 | NaN | NaN | NaN | 2.346 | 1.299 | 0.000 | 1.000 | 2.000 | 3.000 | 5.000 |
| Education_Level | 8608 | 6 | Graduate | 3128 | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| Marital_Status | 9378 | 3 | Married | 4687 | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| Income_Category | 10127 | 6 | Less than $40K | 3561 | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| Card_Category | 10127 | 4 | Blue | 9436 | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| Months_on_book | 10127.000 | NaN | NaN | NaN | 35.928 | 7.986 | 13.000 | 31.000 | 36.000 | 40.000 | 56.000 |
| Total_Relationship_Count | 10127.000 | NaN | NaN | NaN | 3.813 | 1.554 | 1.000 | 3.000 | 4.000 | 5.000 | 6.000 |
| Months_Inactive_12_mon | 10127.000 | NaN | NaN | NaN | 2.341 | 1.011 | 0.000 | 2.000 | 2.000 | 3.000 | 6.000 |
| Contacts_Count_12_mon | 10127.000 | NaN | NaN | NaN | 2.455 | 1.106 | 0.000 | 2.000 | 2.000 | 3.000 | 6.000 |
| Credit_Limit | 10127.000 | NaN | NaN | NaN | 8631.954 | 9088.777 | 1438.300 | 2555.000 | 4549.000 | 11067.500 | 34516.000 |
| Total_Revolving_Bal | 10127.000 | NaN | NaN | NaN | 1162.814 | 814.987 | 0.000 | 359.000 | 1276.000 | 1784.000 | 2517.000 |
| Avg_Open_To_Buy | 10127.000 | NaN | NaN | NaN | 7469.140 | 9090.685 | 3.000 | 1324.500 | 3474.000 | 9859.000 | 34516.000 |
| Total_Amt_Chng_Q4_Q1 | 10127.000 | NaN | NaN | NaN | 0.760 | 0.219 | 0.000 | 0.631 | 0.736 | 0.859 | 3.397 |
| Total_Trans_Amt | 10127.000 | NaN | NaN | NaN | 4404.086 | 3397.129 | 510.000 | 2155.500 | 3899.000 | 4741.000 | 18484.000 |
| Total_Trans_Ct | 10127.000 | NaN | NaN | NaN | 64.859 | 23.473 | 10.000 | 45.000 | 67.000 | 81.000 | 139.000 |
| Total_Ct_Chng_Q4_Q1 | 10127.000 | NaN | NaN | NaN | 0.712 | 0.238 | 0.000 | 0.582 | 0.702 | 0.818 | 3.714 |
| Avg_Utilization_Ratio | 10127.000 | NaN | NaN | NaN | 0.275 | 0.276 | 0.000 | 0.023 | 0.176 | 0.503 | 0.999 |
Observations:
# Function copied from prior case study:
# Let us write a function that will help us create boxplot and histogram for any input numerical variable.
# This function takes the numerical column as the input and returns the boxplots and histograms for the variable.
def histogram_boxplot(feature, figsize=(15, 10), bins=None):
"""Boxplot and histogram combined
feature: 1-d feature array
figsize: size of fig (default (9,8))
bins: number of bins (default None / auto)
"""
sns.set(font_scale=2) # setting the font scale for seaborn
f2, (ax_box2, ax_hist2) = plt.subplots(
nrows=2, # Number of rows of the subplot grid=2
sharex=True, # x-axis will be shared among all subplots
gridspec_kw={"height_ratios": (0.25, 0.75)},
figsize=figsize,
) # creating the 2 subplots
sns.boxplot(
feature, ax=ax_box2, showmeans=True, color="red"
) # boxplot will be created and a star will indicate the mean value of the column
sns.distplot(feature, kde=F, ax=ax_hist2, bins=bins) if bins else sns.distplot(
feature, kde=False, ax=ax_hist2
) # For histogram
ax_hist2.axvline(
feature.mean(), color="g", linestyle="--"
) # Add mean to the histogram
ax_hist2.axvline(
feature.median(), color="black", linestyle="-"
) # Add median to the histogram
histogram_boxplot(bank["Customer_Age"])
# Checking to see how many outliers exist
bank[bank["Customer_Age"] > 65]
| Attrition_Flag | Customer_Age | Gender | Dependent_count | Education_Level | Marital_Status | Income_Category | Card_Category | Months_on_book | Total_Relationship_Count | Months_Inactive_12_mon | Contacts_Count_12_mon | Credit_Limit | Total_Revolving_Bal | Avg_Open_To_Buy | Total_Amt_Chng_Q4_Q1 | Total_Trans_Amt | Total_Trans_Ct | Total_Ct_Chng_Q4_Q1 | Avg_Utilization_Ratio | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 39 | Attrited Customer | 66 | F | 0 | Doctorate | Married | missing | Blue | 56 | 5 | 4 | 3 | 7882.000 | 605 | 7277.000 | 1.052 | 704 | 16 | 0.143 | 0.077 |
| 52 | Existing Customer | 66 | F | 0 | High School | Married | Less than $40K | Blue | 54 | 3 | 4 | 2 | 3171.000 | 2179 | 992.000 | 1.224 | 1946 | 38 | 1.923 | 0.687 |
| 151 | Existing Customer | 68 | M | 1 | Graduate | Married | missing | Blue | 56 | 5 | 2 | 3 | 13860.000 | 1652 | 12208.000 | 1.255 | 1910 | 32 | 1.909 | 0.119 |
| 177 | Existing Customer | 67 | F | 1 | Graduate | Married | Less than $40K | Blue | 56 | 4 | 3 | 2 | 3006.000 | 2517 | 489.000 | 2.053 | 1661 | 32 | 1.000 | 0.837 |
| 198 | Attrited Customer | 68 | M | 0 | High School | Married | Less than $40K | Blue | 52 | 1 | 3 | 2 | 1438.300 | 900 | 538.300 | 0.743 | 760 | 21 | 0.615 | 0.626 |
| 251 | Existing Customer | 73 | M | 0 | High School | Married | $40K - $60K | Blue | 36 | 5 | 3 | 2 | 4469.000 | 1125 | 3344.000 | 1.363 | 1765 | 34 | 1.615 | 0.252 |
| 254 | Existing Customer | 70 | M | 0 | High School | Married | Less than $40K | Blue | 56 | 3 | 2 | 3 | 3252.000 | 1495 | 1757.000 | 0.581 | 1227 | 15 | 0.875 | 0.460 |
| 320 | Existing Customer | 67 | M | 0 | Graduate | Married | $40K - $60K | Blue | 56 | 4 | 2 | 1 | 5876.000 | 1297 | 4579.000 | 1.012 | 2133 | 55 | 0.719 | 0.221 |
| 410 | Existing Customer | 67 | M | 1 | Uneducated | Married | $40K - $60K | Blue | 49 | 4 | 3 | 2 | 3106.000 | 1675 | 1431.000 | 0.781 | 1512 | 38 | 0.407 | 0.539 |
| 432 | Existing Customer | 67 | F | 0 | NaN | Married | missing | Blue | 56 | 4 | 3 | 3 | 10509.000 | 2388 | 8121.000 | 0.777 | 1365 | 34 | 1.429 | 0.227 |
histogram_boxplot(bank["Dependent_count"])
histogram_boxplot(bank["Months_on_book"])
histogram_boxplot(bank["Total_Relationship_Count"])
histogram_boxplot(bank["Months_Inactive_12_mon"])
histogram_boxplot(bank["Contacts_Count_12_mon"])
histogram_boxplot(bank["Credit_Limit"])
histogram_boxplot(bank["Total_Revolving_Bal"])
histogram_boxplot(bank["Avg_Open_To_Buy"])
histogram_boxplot(bank["Total_Trans_Amt"])
histogram_boxplot(bank["Total_Trans_Ct"])
# Checking 10 largest values of Total Transaction Count
bank.Total_Trans_Ct.nlargest(10)
9324 139 9586 138 9213 134 9629 132 9261 131 9269 131 9339 131 9728 131 9841 131 10085 131 Name: Total_Trans_Ct, dtype: int64
histogram_boxplot(bank["Total_Ct_Chng_Q4_Q1"])
bank[bank["Total_Ct_Chng_Q4_Q1"] > 1.5].sort_values(
by="Total_Ct_Chng_Q4_Q1", ascending=True
)
| Attrition_Flag | Customer_Age | Gender | Dependent_count | Education_Level | Marital_Status | Income_Category | Card_Category | Months_on_book | Total_Relationship_Count | Months_Inactive_12_mon | Contacts_Count_12_mon | Credit_Limit | Total_Revolving_Bal | Avg_Open_To_Buy | Total_Amt_Chng_Q4_Q1 | Total_Trans_Amt | Total_Trans_Ct | Total_Ct_Chng_Q4_Q1 | Avg_Utilization_Ratio | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 4086 | Existing Customer | 50 | M | 3 | College | Single | $40K - $60K | Blue | 36 | 3 | 2 | 2 | 3069.000 | 1881 | 1188.000 | 1.111 | 2909 | 58 | 1.522 | 0.613 |
| 122 | Existing Customer | 53 | M | 1 | High School | Married | $80K - $120K | Blue | 47 | 3 | 2 | 2 | 12262.000 | 1836 | 10426.000 | 1.584 | 1659 | 38 | 1.533 | 0.150 |
| 284 | Existing Customer | 61 | M | 0 | Graduate | Married | $40K - $60K | Blue | 52 | 3 | 1 | 2 | 2939.000 | 1999 | 940.000 | 2.145 | 2434 | 33 | 1.538 | 0.680 |
| 132 | Existing Customer | 57 | M | 4 | Graduate | Married | $80K - $120K | Blue | 46 | 3 | 2 | 3 | 19270.000 | 1662 | 17608.000 | 1.186 | 1565 | 28 | 1.545 | 0.086 |
| 968 | Existing Customer | 54 | M | 2 | Graduate | Married | $60K - $80K | Blue | 42 | 6 | 2 | 0 | 3583.000 | 0 | 3583.000 | 1.088 | 1065 | 28 | 1.545 | 0.000 |
| 115 | Existing Customer | 49 | M | 1 | Graduate | Single | $80K - $120K | Blue | 36 | 6 | 2 | 2 | 18886.000 | 895 | 17991.000 | 1.826 | 1235 | 18 | 1.571 | 0.047 |
| 3221 | Existing Customer | 35 | M | 3 | High School | NaN | $80K - $120K | Blue | 30 | 5 | 3 | 3 | 11229.000 | 1054 | 10175.000 | 0.552 | 1898 | 36 | 1.571 | 0.094 |
| 22 | Existing Customer | 41 | M | 3 | High School | Married | $40K - $60K | Blue | 33 | 4 | 2 | 1 | 4470.000 | 680 | 3790.000 | 1.608 | 931 | 18 | 1.571 | 0.152 |
| 28 | Existing Customer | 44 | F | 3 | Uneducated | Single | missing | Blue | 34 | 5 | 2 | 2 | 10100.000 | 0 | 10100.000 | 0.525 | 1052 | 18 | 1.571 | 0.000 |
| 533 | Existing Customer | 59 | F | 0 | NaN | Married | Less than $40K | Blue | 53 | 4 | 3 | 2 | 5512.000 | 1124 | 4388.000 | 1.391 | 1975 | 49 | 1.579 | 0.204 |
| 7134 | Existing Customer | 46 | M | 3 | High School | Married | $60K - $80K | Blue | 36 | 4 | 3 | 1 | 4696.000 | 0 | 4696.000 | 0.732 | 4828 | 62 | 1.583 | 0.000 |
| 255 | Existing Customer | 55 | F | 2 | High School | Married | Less than $40K | Blue | 36 | 4 | 3 | 3 | 2358.000 | 1152 | 1206.000 | 0.969 | 1737 | 26 | 1.600 | 0.489 |
| 31 | Existing Customer | 53 | M | 2 | Uneducated | Married | $60K - $80K | Blue | 48 | 2 | 5 | 1 | 2451.000 | 1690 | 761.000 | 1.323 | 1596 | 26 | 1.600 | 0.690 |
| 2982 | Existing Customer | 45 | M | 4 | NaN | Married | $40K - $60K | Blue | 30 | 6 | 3 | 3 | 1892.000 | 1049 | 843.000 | 1.122 | 4558 | 60 | 1.609 | 0.554 |
| 251 | Existing Customer | 73 | M | 0 | High School | Married | $40K - $60K | Blue | 36 | 5 | 3 | 2 | 4469.000 | 1125 | 3344.000 | 1.363 | 1765 | 34 | 1.615 | 0.252 |
| 282 | Existing Customer | 54 | F | 1 | Uneducated | Married | $40K - $60K | Blue | 44 | 5 | 2 | 3 | 5556.000 | 1711 | 3845.000 | 1.434 | 1706 | 21 | 1.625 | 0.308 |
| 111 | Existing Customer | 42 | M | 3 | NaN | Married | $60K - $80K | Blue | 36 | 5 | 3 | 3 | 15088.000 | 865 | 14223.000 | 0.939 | 1107 | 21 | 1.625 | 0.057 |
| 17 | Existing Customer | 41 | M | 3 | NaN | Married | $80K - $120K | Blue | 34 | 4 | 4 | 1 | 13535.000 | 1291 | 12244.000 | 0.653 | 1028 | 21 | 1.625 | 0.095 |
| 0 | Existing Customer | 45 | M | 3 | High School | Married | $60K - $80K | Blue | 39 | 5 | 1 | 3 | 12691.000 | 777 | 11914.000 | 1.335 | 1144 | 42 | 1.625 | 0.061 |
| 392 | Existing Customer | 56 | M | 3 | High School | Married | $60K - $80K | Blue | 36 | 5 | 1 | 3 | 9226.000 | 1233 | 7993.000 | 1.521 | 1626 | 29 | 1.636 | 0.134 |
| 89 | Existing Customer | 57 | M | 2 | NaN | Married | $120K + | Blue | 45 | 5 | 3 | 3 | 5266.000 | 0 | 5266.000 | 1.702 | 1516 | 29 | 1.636 | 0.000 |
| 1187 | Existing Customer | 51 | F | 4 | Graduate | Single | missing | Blue | 34 | 3 | 1 | 2 | 11221.000 | 1279 | 9942.000 | 1.116 | 1564 | 45 | 1.647 | 0.114 |
| 2565 | Existing Customer | 39 | M | 3 | Graduate | Married | $120K + | Blue | 36 | 3 | 3 | 2 | 32964.000 | 2231 | 30733.000 | 1.731 | 3094 | 45 | 1.647 | 0.068 |
| 4597 | Existing Customer | 39 | M | 2 | Graduate | Married | $60K - $80K | Blue | 23 | 5 | 2 | 1 | 4761.000 | 1561 | 3200.000 | 0.690 | 2045 | 53 | 1.650 | 0.328 |
| 32 | Existing Customer | 41 | M | 4 | Graduate | Married | $60K - $80K | Blue | 36 | 4 | 1 | 2 | 8923.000 | 2517 | 6406.000 | 1.726 | 1589 | 24 | 1.667 | 0.282 |
| 281 | Existing Customer | 41 | M | 4 | High School | NaN | $80K - $120K | Blue | 36 | 4 | 3 | 0 | 23018.000 | 2168 | 20850.000 | 0.859 | 1463 | 24 | 1.667 | 0.094 |
| 9977 | Attrited Customer | 41 | F | 3 | Uneducated | Married | Less than $40K | Blue | 30 | 1 | 2 | 3 | 9491.000 | 0 | 9491.000 | 1.056 | 9061 | 51 | 1.684 | 0.000 |
| 47 | Existing Customer | 59 | M | 1 | Doctorate | Married | $40K - $60K | Blue | 52 | 3 | 2 | 2 | 2548.000 | 2020 | 528.000 | 2.357 | 1719 | 27 | 1.700 | 0.793 |
| 15 | Existing Customer | 44 | M | 4 | NaN | NaN | $80K - $120K | Blue | 37 | 5 | 1 | 2 | 4234.000 | 972 | 3262.000 | 1.707 | 1348 | 27 | 1.700 | 0.230 |
| 1778 | Existing Customer | 38 | F | 2 | Uneducated | Married | Less than $40K | Blue | 28 | 3 | 3 | 3 | 7049.000 | 0 | 7049.000 | 0.988 | 1475 | 27 | 1.700 | 0.000 |
| 2099 | Existing Customer | 65 | F | 1 | Graduate | Single | missing | Blue | 55 | 5 | 2 | 4 | 6463.000 | 1660 | 4803.000 | 0.995 | 2336 | 49 | 1.722 | 0.257 |
| 1041 | Existing Customer | 36 | F | 3 | High School | Married | Less than $40K | Blue | 26 | 6 | 1 | 4 | 4331.000 | 1445 | 2886.000 | 1.070 | 2053 | 33 | 1.750 | 0.334 |
| 322 | Existing Customer | 51 | F | 2 | Uneducated | Divorced | Less than $40K | Blue | 38 | 4 | 1 | 2 | 9648.000 | 1926 | 7722.000 | 0.549 | 1083 | 22 | 1.750 | 0.200 |
| 2683 | Existing Customer | 33 | F | 3 | Post-Graduate | Married | $40K - $60K | Blue | 28 | 5 | 2 | 3 | 1864.000 | 1081 | 783.000 | 1.416 | 2607 | 44 | 1.750 | 0.580 |
| 418 | Existing Customer | 44 | M | 5 | Uneducated | Married | $60K - $80K | Blue | 36 | 3 | 3 | 2 | 8645.000 | 1454 | 7191.000 | 0.708 | 1435 | 25 | 1.778 | 0.168 |
| 760 | Existing Customer | 62 | F | 0 | NaN | Married | $40K - $60K | Blue | 36 | 4 | 2 | 2 | 2964.000 | 2400 | 564.000 | 1.296 | 1557 | 25 | 1.778 | 0.810 |
| 4146 | Existing Customer | 48 | M | 4 | Doctorate | NaN | $80K - $120K | Blue | 40 | 3 | 2 | 2 | 3429.000 | 1268 | 2161.000 | 0.703 | 4422 | 64 | 1.783 | 0.370 |
| 88 | Existing Customer | 44 | M | 3 | High School | Single | $60K - $80K | Blue | 31 | 4 | 3 | 1 | 12756.000 | 837 | 11919.000 | 1.932 | 1413 | 14 | 1.800 | 0.066 |
| 346 | Existing Customer | 58 | F | 3 | High School | Married | Less than $40K | Blue | 47 | 6 | 1 | 0 | 2609.000 | 2439 | 170.000 | 1.269 | 1731 | 34 | 1.833 | 0.935 |
| 697 | Existing Customer | 55 | M | 2 | High School | Married | $80K - $120K | Blue | 36 | 3 | 2 | 3 | 6514.000 | 2258 | 4256.000 | 0.785 | 1383 | 20 | 1.857 | 0.347 |
| 76 | Existing Customer | 44 | F | 4 | Graduate | Single | Less than $40K | Blue | 36 | 6 | 4 | 2 | 7000.000 | 2517 | 4483.000 | 0.475 | 1112 | 23 | 1.875 | 0.360 |
| 324 | Existing Customer | 55 | F | 2 | Uneducated | Married | missing | Blue | 35 | 3 | 3 | 0 | 3025.000 | 2376 | 649.000 | 1.252 | 1277 | 23 | 1.875 | 0.785 |
| 323 | Existing Customer | 52 | M | 2 | High School | Single | $80K - $120K | Silver | 40 | 3 | 3 | 3 | 34516.000 | 2177 | 32339.000 | 1.320 | 1234 | 23 | 1.875 | 0.063 |
| 2358 | Existing Customer | 28 | M | 0 | High School | Married | missing | Blue | 21 | 5 | 3 | 5 | 25618.000 | 1209 | 24409.000 | 1.228 | 2157 | 49 | 1.882 | 0.047 |
| 151 | Existing Customer | 68 | M | 1 | Graduate | Married | missing | Blue | 56 | 5 | 2 | 3 | 13860.000 | 1652 | 12208.000 | 1.255 | 1910 | 32 | 1.909 | 0.119 |
| 52 | Existing Customer | 66 | F | 0 | High School | Married | Less than $40K | Blue | 54 | 3 | 4 | 2 | 3171.000 | 2179 | 992.000 | 1.224 | 1946 | 38 | 1.923 | 0.687 |
| 2696 | Existing Customer | 47 | F | 3 | Uneducated | Married | Less than $40K | Blue | 32 | 4 | 3 | 2 | 2821.000 | 951 | 1870.000 | 0.577 | 1452 | 38 | 1.923 | 0.337 |
| 300 | Existing Customer | 50 | M | 0 | High School | Single | $120K + | Silver | 45 | 5 | 2 | 3 | 14938.000 | 2303 | 12635.000 | 0.804 | 949 | 27 | 2.000 | 0.154 |
| 231 | Existing Customer | 57 | M | 2 | NaN | Married | $80K - $120K | Blue | 46 | 2 | 3 | 0 | 18871.000 | 1740 | 17131.000 | 1.727 | 1516 | 21 | 2.000 | 0.092 |
| 69 | Existing Customer | 50 | M | 2 | Doctorate | Married | $80K - $120K | Blue | 38 | 6 | 2 | 2 | 25300.000 | 1330 | 23970.000 | 1.072 | 837 | 15 | 2.000 | 0.053 |
| 1256 | Existing Customer | 43 | M | 2 | High School | Divorced | $80K - $120K | Blue | 33 | 4 | 3 | 2 | 3083.000 | 1898 | 1185.000 | 1.042 | 1448 | 30 | 2.000 | 0.616 |
| 13 | Existing Customer | 35 | M | 3 | Graduate | NaN | $60K - $80K | Blue | 30 | 5 | 1 | 3 | 8547.000 | 1666 | 6881.000 | 1.163 | 1311 | 33 | 2.000 | 0.195 |
| 456 | Existing Customer | 47 | M | 3 | Uneducated | Married | $80K - $120K | Blue | 36 | 6 | 2 | 2 | 29770.000 | 1565 | 28205.000 | 0.674 | 1774 | 42 | 2.000 | 0.053 |
| 84 | Existing Customer | 53 | M | 1 | Graduate | Divorced | $80K - $120K | Blue | 35 | 5 | 4 | 2 | 34516.000 | 1219 | 33297.000 | 1.129 | 1590 | 27 | 2.000 | 0.035 |
| 1455 | Existing Customer | 39 | F | 2 | Doctorate | Married | missing | Blue | 36 | 5 | 2 | 4 | 8058.000 | 791 | 7267.000 | 1.787 | 2742 | 42 | 2.000 | 0.098 |
| 294 | Existing Customer | 45 | M | 2 | College | Single | $60K - $80K | Blue | 33 | 6 | 3 | 0 | 23218.000 | 1814 | 21404.000 | 1.178 | 1749 | 37 | 2.083 | 0.078 |
| 309 | Existing Customer | 43 | F | 4 | Uneducated | Married | Less than $40K | Blue | 36 | 2 | 1 | 1 | 9684.000 | 2475 | 7209.000 | 0.697 | 1400 | 31 | 2.100 | 0.256 |
| 162 | Existing Customer | 46 | M | 1 | Uneducated | Married | $60K - $80K | Blue | 36 | 3 | 2 | 2 | 20459.000 | 2071 | 18388.000 | 1.248 | 1767 | 38 | 2.167 | 0.101 |
| 91 | Existing Customer | 49 | M | 4 | High School | Single | $80K - $120K | Blue | 38 | 4 | 3 | 0 | 31302.000 | 1953 | 29349.000 | 0.875 | 1564 | 35 | 2.182 | 0.062 |
| 131 | Existing Customer | 43 | M | 4 | NaN | Married | $40K - $60K | Blue | 39 | 5 | 1 | 2 | 6111.000 | 2517 | 3594.000 | 0.632 | 1221 | 16 | 2.200 | 0.412 |
| 757 | Attrited Customer | 43 | M | 2 | Uneducated | Married | $60K - $80K | Blue | 24 | 2 | 3 | 3 | 14447.000 | 0 | 14447.000 | 0.856 | 915 | 29 | 2.222 | 0.000 |
| 1095 | Existing Customer | 54 | F | 3 | Doctorate | Married | $40K - $60K | Blue | 39 | 3 | 1 | 3 | 2112.000 | 1594 | 518.000 | 1.204 | 1338 | 29 | 2.222 | 0.755 |
| 239 | Existing Customer | 44 | M | 4 | NaN | Single | $80K - $120K | Blue | 34 | 4 | 1 | 2 | 21573.000 | 1585 | 19988.000 | 0.621 | 1384 | 36 | 2.273 | 0.073 |
| 167 | Existing Customer | 58 | F | 4 | Uneducated | Married | Less than $40K | Blue | 47 | 3 | 3 | 3 | 2822.000 | 2173 | 649.000 | 1.456 | 1218 | 23 | 2.286 | 0.770 |
| 2 | Existing Customer | 51 | M | 3 | Graduate | Married | $80K - $120K | Blue | 36 | 4 | 1 | 0 | 3418.000 | 0 | 3418.000 | 2.594 | 1887 | 20 | 2.333 | 0.000 |
| 3 | Existing Customer | 40 | F | 4 | High School | NaN | Less than $40K | Blue | 34 | 3 | 4 | 1 | 3313.000 | 2517 | 796.000 | 1.405 | 1171 | 20 | 2.333 | 0.760 |
| 280 | Existing Customer | 43 | M | 1 | Graduate | Single | $80K - $120K | Silver | 37 | 4 | 3 | 2 | 34516.000 | 1440 | 33076.000 | 1.117 | 1575 | 34 | 2.400 | 0.042 |
| 68 | Existing Customer | 49 | M | 2 | Graduate | Married | $60K - $80K | Blue | 32 | 2 | 2 | 2 | 1687.000 | 1107 | 580.000 | 1.715 | 1670 | 17 | 2.400 | 0.656 |
| 158 | Existing Customer | 44 | F | 2 | Uneducated | Married | missing | Silver | 35 | 4 | 3 | 2 | 32643.000 | 0 | 32643.000 | 1.300 | 1058 | 24 | 2.429 | 0.000 |
| 4 | Existing Customer | 40 | M | 3 | Uneducated | Married | $60K - $80K | Blue | 21 | 5 | 1 | 0 | 4716.000 | 0 | 4716.000 | 2.175 | 816 | 28 | 2.500 | 0.000 |
| 805 | Existing Customer | 29 | M | 0 | Post-Graduate | Single | $40K - $60K | Blue | 19 | 4 | 1 | 2 | 13632.000 | 1482 | 12150.000 | 0.893 | 2168 | 42 | 2.500 | 0.109 |
| 2510 | Attrited Customer | 54 | M | 3 | High School | Married | $40K - $60K | Blue | 44 | 2 | 1 | 5 | 3032.000 | 0 | 3032.000 | 0.949 | 1037 | 14 | 2.500 | 0.000 |
| 30 | Existing Customer | 53 | M | 3 | NaN | Married | $80K - $120K | Blue | 33 | 3 | 2 | 3 | 2753.000 | 1811 | 942.000 | 0.977 | 1038 | 25 | 2.571 | 0.658 |
| 366 | Existing Customer | 36 | F | 4 | Graduate | Married | $40K - $60K | Blue | 36 | 6 | 3 | 3 | 1628.000 | 969 | 659.000 | 0.999 | 1893 | 15 | 2.750 | 0.595 |
| 146 | Existing Customer | 41 | F | 2 | Graduate | Single | Less than $40K | Blue | 32 | 6 | 3 | 2 | 2250.000 | 2117 | 133.000 | 1.162 | 1617 | 31 | 2.875 | 0.941 |
| 190 | Existing Customer | 57 | M | 1 | Graduate | Married | $80K - $120K | Blue | 47 | 5 | 3 | 1 | 14612.000 | 1976 | 12636.000 | 1.768 | 1827 | 24 | 3.000 | 0.135 |
| 113 | Existing Customer | 54 | F | 0 | Uneducated | Married | Less than $40K | Blue | 36 | 2 | 2 | 2 | 1494.000 | 706 | 788.000 | 1.674 | 1305 | 24 | 3.000 | 0.473 |
| 12 | Existing Customer | 56 | M | 1 | College | Single | $80K - $120K | Blue | 36 | 3 | 6 | 0 | 11751.000 | 0 | 11751.000 | 3.397 | 1539 | 17 | 3.250 | 0.000 |
| 269 | Existing Customer | 54 | M | 5 | Graduate | Married | $60K - $80K | Blue | 38 | 3 | 3 | 3 | 2290.000 | 1434 | 856.000 | 0.923 | 1119 | 18 | 3.500 | 0.626 |
| 773 | Existing Customer | 61 | M | 0 | Post-Graduate | Married | missing | Blue | 53 | 6 | 2 | 3 | 14434.000 | 1927 | 12507.000 | 2.675 | 1731 | 32 | 3.571 | 0.134 |
| 1 | Existing Customer | 49 | F | 5 | Graduate | Single | Less than $40K | Blue | 44 | 6 | 1 | 2 | 8256.000 | 864 | 7392.000 | 1.541 | 1291 | 33 | 3.714 | 0.105 |
bank["Total_Ct_Chng_Q4_Q1"].clip(upper=1.6, inplace=True)
histogram_boxplot(bank["Total_Amt_Chng_Q4_Q1"])
bank[bank["Total_Amt_Chng_Q4_Q1"] > 1.5].sort_values(
by="Total_Amt_Chng_Q4_Q1", ascending=True
)
| Attrition_Flag | Customer_Age | Gender | Dependent_count | Education_Level | Marital_Status | Income_Category | Card_Category | Months_on_book | Total_Relationship_Count | Months_Inactive_12_mon | Contacts_Count_12_mon | Credit_Limit | Total_Revolving_Bal | Avg_Open_To_Buy | Total_Amt_Chng_Q4_Q1 | Total_Trans_Amt | Total_Trans_Ct | Total_Ct_Chng_Q4_Q1 | Avg_Utilization_Ratio | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 358 | Existing Customer | 61 | F | 0 | Graduate | Married | missing | Blue | 56 | 4 | 1 | 3 | 5585.000 | 1465 | 4120.000 | 1.503 | 1787 | 31 | 0.722 | 0.262 |
| 2380 | Existing Customer | 35 | M | 1 | High School | Married | $60K - $80K | Blue | 26 | 4 | 3 | 2 | 4008.000 | 1841 | 2167.000 | 1.504 | 2794 | 58 | 1.148 | 0.459 |
| 1786 | Existing Customer | 33 | F | 2 | High School | Married | Less than $40K | Blue | 27 | 3 | 2 | 3 | 7185.000 | 0 | 7185.000 | 1.504 | 2679 | 45 | 0.800 | 0.000 |
| 1810 | Existing Customer | 37 | M | 3 | Uneducated | Married | $80K - $120K | Blue | 31 | 4 | 2 | 2 | 3797.000 | 1425 | 2372.000 | 1.505 | 2555 | 44 | 0.833 | 0.375 |
| 2012 | Existing Customer | 37 | M | 3 | NaN | Married | $60K - $80K | Blue | 30 | 6 | 2 | 4 | 16043.000 | 0 | 16043.000 | 1.509 | 2599 | 47 | 1.136 | 0.000 |
| 202 | Existing Customer | 48 | M | 3 | College | Married | $80K - $120K | Blue | 41 | 4 | 5 | 3 | 12302.000 | 1632 | 10670.000 | 1.509 | 1483 | 41 | 0.519 | 0.133 |
| 1990 | Existing Customer | 65 | M | 0 | NaN | Single | missing | Blue | 56 | 3 | 2 | 2 | 11332.000 | 633 | 10699.000 | 1.514 | 2758 | 56 | 1.240 | 0.056 |
| 1407 | Existing Customer | 33 | F | 3 | Graduate | Married | Less than $40K | Blue | 25 | 3 | 2 | 2 | 2307.000 | 1385 | 922.000 | 1.515 | 2440 | 48 | 0.846 | 0.600 |
| 656 | Existing Customer | 55 | F | 4 | Graduate | Married | $40K - $60K | Blue | 41 | 4 | 3 | 3 | 3156.000 | 2517 | 639.000 | 1.516 | 2091 | 48 | 0.778 | 0.798 |
| 495 | Existing Customer | 52 | M | 4 | High School | Married | $80K - $120K | Blue | 42 | 6 | 1 | 0 | 5738.000 | 1112 | 4626.000 | 1.519 | 1922 | 48 | 0.655 | 0.194 |
| 1521 | Existing Customer | 36 | M | 2 | Doctorate | Married | $60K - $80K | Blue | 30 | 3 | 3 | 4 | 4934.000 | 1504 | 3430.000 | 1.520 | 2747 | 42 | 0.448 | 0.305 |
| 392 | Existing Customer | 56 | M | 3 | High School | Married | $60K - $80K | Blue | 36 | 5 | 1 | 3 | 9226.000 | 1233 | 7993.000 | 1.521 | 1626 | 29 | 1.600 | 0.134 |
| 9 | Existing Customer | 48 | M | 2 | Graduate | Single | $80K - $120K | Blue | 36 | 6 | 3 | 3 | 11656.000 | 1677 | 9979.000 | 1.524 | 1441 | 32 | 0.882 | 0.144 |
| 1599 | Existing Customer | 35 | F | 1 | High School | Married | missing | Blue | 17 | 5 | 3 | 3 | 4588.000 | 2517 | 2071.000 | 1.525 | 2442 | 62 | 0.632 | 0.549 |
| 3061 | Existing Customer | 44 | M | 3 | NaN | Married | $80K - $120K | Blue | 38 | 3 | 1 | 4 | 4198.000 | 1782 | 2416.000 | 1.526 | 2051 | 36 | 1.000 | 0.424 |
| 263 | Existing Customer | 46 | F | 1 | NaN | Married | Less than $40K | Blue | 36 | 2 | 3 | 2 | 2474.000 | 2143 | 331.000 | 1.530 | 1541 | 40 | 1.000 | 0.866 |
| 1 | Existing Customer | 49 | F | 5 | Graduate | Single | Less than $40K | Blue | 44 | 6 | 1 | 2 | 8256.000 | 864 | 7392.000 | 1.541 | 1291 | 33 | 1.600 | 0.105 |
| 133 | Existing Customer | 52 | M | 1 | Graduate | Married | $80K - $120K | Blue | 43 | 3 | 1 | 4 | 3710.000 | 2517 | 1193.000 | 1.541 | 1578 | 34 | 0.700 | 0.678 |
| 919 | Existing Customer | 33 | M | 2 | Post-Graduate | Married | $80K - $120K | Blue | 22 | 3 | 3 | 3 | 1438.300 | 681 | 757.300 | 1.542 | 2730 | 48 | 0.778 | 0.473 |
| 1934 | Existing Customer | 36 | F | 2 | NaN | Married | Less than $40K | Blue | 27 | 3 | 3 | 4 | 3049.000 | 2198 | 851.000 | 1.546 | 2617 | 48 | 1.000 | 0.721 |
| 1060 | Existing Customer | 37 | F | 2 | Graduate | Married | Less than $40K | Blue | 30 | 5 | 2 | 2 | 2077.000 | 1392 | 685.000 | 1.553 | 1629 | 36 | 1.250 | 0.670 |
| 870 | Existing Customer | 53 | M | 3 | Graduate | Married | $120K + | Blue | 44 | 3 | 2 | 3 | 12163.000 | 2082 | 10081.000 | 1.554 | 2649 | 56 | 0.697 | 0.171 |
| 761 | Existing Customer | 58 | M | 0 | Uneducated | Married | $80K - $120K | Blue | 38 | 6 | 3 | 3 | 3785.000 | 1935 | 1850.000 | 1.558 | 1824 | 49 | 1.450 | 0.511 |
| 1647 | Existing Customer | 37 | M | 3 | NaN | Married | $60K - $80K | Blue | 24 | 3 | 1 | 2 | 11894.000 | 816 | 11078.000 | 1.561 | 2438 | 45 | 0.607 | 0.069 |
| 1011 | Existing Customer | 31 | M | 2 | Uneducated | Married | Less than $40K | Blue | 18 | 3 | 2 | 4 | 1438.300 | 0 | 1438.300 | 1.561 | 2789 | 50 | 1.083 | 0.000 |
| 1491 | Existing Customer | 36 | F | 3 | High School | Married | Less than $40K | Blue | 27 | 4 | 2 | 4 | 3444.000 | 2441 | 1003.000 | 1.563 | 2668 | 51 | 0.545 | 0.709 |
| 501 | Existing Customer | 55 | M | 1 | High School | Married | $80K - $120K | Blue | 45 | 3 | 3 | 3 | 16794.000 | 809 | 15985.000 | 1.566 | 1917 | 33 | 0.941 | 0.048 |
| 2761 | Existing Customer | 39 | M | 4 | High School | Married | $80K - $120K | Blue | 25 | 6 | 2 | 3 | 8208.000 | 0 | 8208.000 | 1.568 | 3135 | 39 | 1.167 | 0.000 |
| 906 | Existing Customer | 42 | M | 3 | High School | Single | $40K - $60K | Blue | 35 | 4 | 3 | 3 | 3266.000 | 1900 | 1366.000 | 1.568 | 2183 | 56 | 0.750 | 0.582 |
| 2752 | Existing Customer | 37 | M | 3 | Graduate | Married | $60K - $80K | Blue | 31 | 3 | 1 | 3 | 4940.000 | 1199 | 3741.000 | 1.570 | 3246 | 57 | 0.900 | 0.243 |
| 1882 | Existing Customer | 36 | M | 3 | College | Married | $120K + | Blue | 26 | 3 | 2 | 3 | 17116.000 | 939 | 16177.000 | 1.575 | 2547 | 45 | 0.731 | 0.055 |
| 1118 | Existing Customer | 29 | M | 0 | High School | Married | $40K - $60K | Blue | 13 | 4 | 1 | 4 | 1458.000 | 671 | 787.000 | 1.583 | 2449 | 56 | 0.931 | 0.460 |
| 122 | Existing Customer | 53 | M | 1 | High School | Married | $80K - $120K | Blue | 47 | 3 | 2 | 2 | 12262.000 | 1836 | 10426.000 | 1.584 | 1659 | 38 | 1.533 | 0.150 |
| 1051 | Existing Customer | 54 | F | 1 | Uneducated | Married | Less than $40K | Blue | 40 | 5 | 2 | 4 | 2178.000 | 1144 | 1034.000 | 1.585 | 1724 | 47 | 1.043 | 0.525 |
| 1195 | Existing Customer | 36 | M | 2 | Graduate | Married | $80K - $120K | Blue | 28 | 5 | 3 | 3 | 5634.000 | 1996 | 3638.000 | 1.589 | 2366 | 49 | 0.690 | 0.354 |
| 1008 | Existing Customer | 39 | F | 1 | Graduate | Married | missing | Blue | 30 | 3 | 2 | 3 | 2917.000 | 1357 | 1560.000 | 1.593 | 2422 | 46 | 0.438 | 0.465 |
| 2324 | Existing Customer | 37 | F | 4 | Graduate | Married | Less than $40K | Blue | 28 | 4 | 3 | 1 | 1825.000 | 1389 | 436.000 | 1.595 | 2878 | 54 | 0.636 | 0.761 |
| 1417 | Existing Customer | 39 | F | 1 | Graduate | Married | $40K - $60K | Blue | 27 | 3 | 1 | 2 | 2700.000 | 2220 | 480.000 | 1.595 | 2901 | 59 | 1.360 | 0.822 |
| 1166 | Existing Customer | 38 | F | 2 | Graduate | Married | Less than $40K | Blue | 36 | 6 | 3 | 4 | 2717.000 | 1591 | 1126.000 | 1.596 | 2064 | 33 | 1.062 | 0.586 |
| 1993 | Existing Customer | 31 | M | 2 | College | Married | Less than $40K | Blue | 21 | 6 | 2 | 4 | 2718.000 | 1920 | 798.000 | 1.604 | 2570 | 49 | 1.042 | 0.706 |
| 22 | Existing Customer | 41 | M | 3 | High School | Married | $40K - $60K | Blue | 33 | 4 | 2 | 1 | 4470.000 | 680 | 3790.000 | 1.608 | 931 | 18 | 1.571 | 0.152 |
| 2263 | Existing Customer | 45 | F | 4 | Uneducated | Married | $40K - $60K | Blue | 36 | 3 | 1 | 3 | 3111.000 | 2290 | 821.000 | 1.612 | 1998 | 41 | 0.464 | 0.736 |
| 45 | Existing Customer | 49 | M | 4 | Uneducated | Single | $80K - $120K | Blue | 30 | 3 | 2 | 3 | 34516.000 | 0 | 34516.000 | 1.621 | 1444 | 28 | 1.333 | 0.000 |
| 1473 | Existing Customer | 35 | M | 2 | Graduate | Married | $60K - $80K | Blue | 36 | 3 | 3 | 2 | 1438.300 | 0 | 1438.300 | 1.623 | 2492 | 55 | 0.897 | 0.000 |
| 2530 | Existing Customer | 35 | M | 3 | Graduate | Married | $120K + | Blue | 28 | 4 | 3 | 2 | 14869.000 | 0 | 14869.000 | 1.624 | 2753 | 48 | 1.087 | 0.000 |
| 1627 | Existing Customer | 38 | F | 2 | Graduate | Married | Less than $40K | Blue | 33 | 5 | 2 | 3 | 2228.000 | 1717 | 511.000 | 1.625 | 2334 | 61 | 0.848 | 0.771 |
| 1879 | Existing Customer | 35 | F | 1 | Graduate | Married | $40K - $60K | Blue | 29 | 4 | 2 | 2 | 2523.000 | 1877 | 646.000 | 1.631 | 2005 | 50 | 1.174 | 0.744 |
| 2321 | Existing Customer | 36 | M | 2 | Uneducated | Married | $60K - $80K | Blue | 21 | 4 | 1 | 5 | 12763.000 | 2517 | 10246.000 | 1.631 | 2599 | 46 | 0.917 | 0.197 |
| 914 | Existing Customer | 55 | M | 2 | College | Married | $80K - $120K | Blue | 45 | 5 | 1 | 2 | 2929.000 | 2431 | 498.000 | 1.632 | 1903 | 39 | 0.625 | 0.830 |
| 714 | Existing Customer | 38 | M | 1 | High School | Married | $80K - $120K | Blue | 23 | 4 | 3 | 2 | 22149.000 | 987 | 21162.000 | 1.633 | 2409 | 36 | 0.800 | 0.045 |
| 422 | Existing Customer | 63 | M | 0 | High School | Married | $60K - $80K | Blue | 36 | 6 | 2 | 3 | 2567.000 | 0 | 2567.000 | 1.636 | 2399 | 43 | 0.955 | 0.000 |
| 197 | Existing Customer | 53 | M | 3 | Uneducated | Married | $80K - $120K | Blue | 43 | 3 | 3 | 1 | 16393.000 | 1423 | 14970.000 | 1.642 | 1461 | 42 | 0.750 | 0.087 |
| 975 | Existing Customer | 59 | M | 1 | Post-Graduate | Married | $40K - $60K | Blue | 36 | 4 | 2 | 2 | 2483.000 | 1372 | 1111.000 | 1.642 | 1704 | 35 | 0.458 | 0.553 |
| 1232 | Existing Customer | 58 | M | 1 | Uneducated | Married | $80K - $120K | Blue | 50 | 5 | 3 | 2 | 6978.000 | 1148 | 5830.000 | 1.645 | 1362 | 26 | 1.000 | 0.165 |
| 95 | Existing Customer | 64 | M | 1 | Graduate | Married | Less than $40K | Blue | 52 | 6 | 4 | 3 | 1709.000 | 895 | 814.000 | 1.656 | 1673 | 32 | 0.882 | 0.524 |
| 1883 | Existing Customer | 37 | M | 2 | College | Married | $80K - $120K | Blue | 17 | 5 | 3 | 2 | 4631.000 | 1991 | 2640.000 | 1.669 | 2864 | 37 | 0.947 | 0.430 |
| 113 | Existing Customer | 54 | F | 0 | Uneducated | Married | Less than $40K | Blue | 36 | 2 | 2 | 2 | 1494.000 | 706 | 788.000 | 1.674 | 1305 | 24 | 1.600 | 0.473 |
| 3270 | Existing Customer | 49 | M | 3 | High School | NaN | $60K - $80K | Blue | 36 | 3 | 2 | 2 | 9551.000 | 1833 | 7718.000 | 1.675 | 3213 | 52 | 1.476 | 0.192 |
| 1570 | Existing Customer | 49 | M | 2 | NaN | Single | $60K - $80K | Blue | 38 | 4 | 1 | 2 | 2461.000 | 1586 | 875.000 | 1.676 | 1729 | 35 | 0.750 | 0.644 |
| 137 | Existing Customer | 45 | M | 4 | College | Divorced | $60K - $80K | Blue | 40 | 5 | 1 | 0 | 10408.000 | 1186 | 9222.000 | 1.689 | 2560 | 42 | 1.211 | 0.114 |
| 89 | Existing Customer | 57 | M | 2 | NaN | Married | $120K + | Blue | 45 | 5 | 3 | 3 | 5266.000 | 0 | 5266.000 | 1.702 | 1516 | 29 | 1.600 | 0.000 |
| 94 | Existing Customer | 45 | F | 3 | NaN | Married | missing | Blue | 28 | 5 | 1 | 2 | 2535.000 | 2440 | 95.000 | 1.705 | 1312 | 20 | 1.222 | 0.963 |
| 1689 | Existing Customer | 34 | M | 0 | Graduate | Married | $60K - $80K | Blue | 26 | 4 | 3 | 3 | 5175.000 | 977 | 4198.000 | 1.705 | 2405 | 49 | 0.885 | 0.189 |
| 15 | Existing Customer | 44 | M | 4 | NaN | NaN | $80K - $120K | Blue | 37 | 5 | 1 | 2 | 4234.000 | 972 | 3262.000 | 1.707 | 1348 | 27 | 1.600 | 0.230 |
| 336 | Existing Customer | 56 | F | 1 | Graduate | Married | Less than $40K | Blue | 38 | 4 | 3 | 3 | 2578.000 | 2462 | 116.000 | 1.707 | 1378 | 29 | 0.812 | 0.955 |
| 16 | Existing Customer | 48 | M | 4 | Post-Graduate | Single | $80K - $120K | Blue | 36 | 6 | 2 | 3 | 30367.000 | 2362 | 28005.000 | 1.708 | 1671 | 27 | 0.929 | 0.078 |
| 68 | Existing Customer | 49 | M | 2 | Graduate | Married | $60K - $80K | Blue | 32 | 2 | 2 | 2 | 1687.000 | 1107 | 580.000 | 1.715 | 1670 | 17 | 1.600 | 0.656 |
| 36 | Existing Customer | 55 | F | 3 | Graduate | Married | Less than $40K | Blue | 36 | 6 | 2 | 3 | 3035.000 | 2298 | 737.000 | 1.724 | 1877 | 37 | 1.176 | 0.757 |
| 32 | Existing Customer | 41 | M | 4 | Graduate | Married | $60K - $80K | Blue | 36 | 4 | 1 | 2 | 8923.000 | 2517 | 6406.000 | 1.726 | 1589 | 24 | 1.600 | 0.282 |
| 231 | Existing Customer | 57 | M | 2 | NaN | Married | $80K - $120K | Blue | 46 | 2 | 3 | 0 | 18871.000 | 1740 | 17131.000 | 1.727 | 1516 | 21 | 1.600 | 0.092 |
| 2565 | Existing Customer | 39 | M | 3 | Graduate | Married | $120K + | Blue | 36 | 3 | 3 | 2 | 32964.000 | 2231 | 30733.000 | 1.731 | 3094 | 45 | 1.600 | 0.068 |
| 2337 | Existing Customer | 50 | F | 2 | Graduate | Divorced | $40K - $60K | Blue | 40 | 6 | 2 | 5 | 8307.000 | 2517 | 5790.000 | 1.743 | 2293 | 36 | 0.800 | 0.303 |
| 1369 | Existing Customer | 36 | F | 2 | Uneducated | Married | Less than $40K | Blue | 36 | 4 | 2 | 2 | 4066.000 | 1639 | 2427.000 | 1.749 | 3040 | 56 | 0.931 | 0.403 |
| 33 | Existing Customer | 53 | F | 2 | College | Married | Less than $40K | Blue | 38 | 5 | 2 | 3 | 2650.000 | 1490 | 1160.000 | 1.750 | 1411 | 28 | 1.000 | 0.562 |
| 190 | Existing Customer | 57 | M | 1 | Graduate | Married | $80K - $120K | Blue | 47 | 5 | 3 | 1 | 14612.000 | 1976 | 12636.000 | 1.768 | 1827 | 24 | 1.600 | 0.135 |
| 1718 | Existing Customer | 42 | F | 4 | Post-Graduate | Single | Less than $40K | Blue | 36 | 6 | 2 | 3 | 1438.300 | 674 | 764.300 | 1.769 | 2451 | 55 | 1.292 | 0.469 |
| 1455 | Existing Customer | 39 | F | 2 | Doctorate | Married | missing | Blue | 36 | 5 | 2 | 4 | 8058.000 | 791 | 7267.000 | 1.787 | 2742 | 42 | 1.600 | 0.098 |
| 180 | Existing Customer | 45 | M | 2 | Uneducated | Married | $40K - $60K | Blue | 34 | 3 | 2 | 1 | 5771.000 | 2248 | 3523.000 | 1.791 | 1387 | 18 | 0.800 | 0.390 |
| 1486 | Existing Customer | 39 | M | 2 | Graduate | Married | $40K - $60K | Blue | 31 | 5 | 3 | 2 | 8687.000 | 1146 | 7541.000 | 1.800 | 2279 | 33 | 1.357 | 0.132 |
| 115 | Existing Customer | 49 | M | 1 | Graduate | Single | $80K - $120K | Blue | 36 | 6 | 2 | 2 | 18886.000 | 895 | 17991.000 | 1.826 | 1235 | 18 | 1.571 | 0.047 |
| 18 | Existing Customer | 61 | M | 1 | High School | Married | $40K - $60K | Blue | 56 | 2 | 2 | 3 | 3193.000 | 2517 | 676.000 | 1.831 | 1336 | 30 | 1.143 | 0.788 |
| 295 | Existing Customer | 60 | M | 0 | High School | Married | $40K - $60K | Blue | 36 | 5 | 1 | 3 | 3281.000 | 837 | 2444.000 | 1.859 | 1424 | 29 | 1.417 | 0.255 |
| 855 | Existing Customer | 39 | F | 2 | Graduate | Married | missing | Blue | 31 | 4 | 2 | 3 | 1438.300 | 997 | 441.300 | 1.867 | 2583 | 47 | 0.958 | 0.693 |
| 117 | Existing Customer | 50 | M | 3 | High School | Single | $80K - $120K | Blue | 39 | 4 | 1 | 4 | 9964.000 | 1559 | 8405.000 | 1.873 | 1626 | 25 | 0.786 | 0.156 |
| 1176 | Existing Customer | 34 | M | 2 | College | Married | $80K - $120K | Blue | 22 | 4 | 2 | 4 | 1631.000 | 0 | 1631.000 | 1.893 | 2962 | 57 | 1.111 | 0.000 |
| 869 | Existing Customer | 39 | M | 2 | College | Married | $60K - $80K | Blue | 35 | 4 | 3 | 2 | 7410.000 | 2517 | 4893.000 | 1.924 | 2398 | 37 | 1.176 | 0.340 |
| 88 | Existing Customer | 44 | M | 3 | High School | Single | $60K - $80K | Blue | 31 | 4 | 3 | 1 | 12756.000 | 837 | 11919.000 | 1.932 | 1413 | 14 | 1.600 | 0.066 |
| 6 | Existing Customer | 51 | M | 4 | NaN | Married | $120K + | Gold | 46 | 6 | 1 | 3 | 34516.000 | 2264 | 32252.000 | 1.975 | 1330 | 31 | 0.722 | 0.066 |
| 142 | Existing Customer | 54 | M | 4 | Graduate | Married | $80K - $120K | Blue | 34 | 2 | 3 | 2 | 14926.000 | 2517 | 12409.000 | 1.996 | 1576 | 25 | 1.500 | 0.169 |
| 431 | Existing Customer | 47 | F | 4 | NaN | Divorced | $40K - $60K | Blue | 34 | 6 | 1 | 2 | 3502.000 | 1851 | 1651.000 | 2.023 | 1814 | 31 | 0.722 | 0.529 |
| 1873 | Existing Customer | 38 | M | 3 | Uneducated | Married | $60K - $80K | Blue | 36 | 5 | 2 | 3 | 3421.000 | 2308 | 1113.000 | 2.037 | 2269 | 39 | 1.053 | 0.675 |
| 1085 | Existing Customer | 45 | F | 3 | Graduate | Single | missing | Blue | 36 | 3 | 3 | 4 | 11189.000 | 2517 | 8672.000 | 2.041 | 2959 | 58 | 1.231 | 0.225 |
| 177 | Existing Customer | 67 | F | 1 | Graduate | Married | Less than $40K | Blue | 56 | 4 | 3 | 2 | 3006.000 | 2517 | 489.000 | 2.053 | 1661 | 32 | 1.000 | 0.837 |
| 1219 | Existing Customer | 38 | F | 4 | Graduate | Married | missing | Blue | 28 | 4 | 1 | 2 | 6861.000 | 1598 | 5263.000 | 2.103 | 2228 | 39 | 0.950 | 0.233 |
| 154 | Existing Customer | 53 | F | 1 | College | Married | Less than $40K | Blue | 47 | 4 | 2 | 3 | 2154.000 | 930 | 1224.000 | 2.121 | 1439 | 26 | 1.364 | 0.432 |
| 284 | Existing Customer | 61 | M | 0 | Graduate | Married | $40K - $60K | Blue | 52 | 3 | 1 | 2 | 2939.000 | 1999 | 940.000 | 2.145 | 2434 | 33 | 1.538 | 0.680 |
| 4 | Existing Customer | 40 | M | 3 | Uneducated | Married | $60K - $80K | Blue | 21 | 5 | 1 | 0 | 4716.000 | 0 | 4716.000 | 2.175 | 816 | 28 | 1.600 | 0.000 |
| 841 | Existing Customer | 37 | F | 3 | NaN | Married | Less than $40K | Blue | 25 | 6 | 2 | 1 | 1438.300 | 674 | 764.300 | 2.180 | 1717 | 31 | 0.722 | 0.469 |
| 7 | Existing Customer | 32 | M | 0 | High School | NaN | $60K - $80K | Silver | 27 | 2 | 2 | 2 | 29081.000 | 1396 | 27685.000 | 2.204 | 1538 | 36 | 0.714 | 0.048 |
| 466 | Existing Customer | 63 | M | 2 | Graduate | Married | $60K - $80K | Blue | 49 | 5 | 2 | 3 | 14035.000 | 2061 | 11974.000 | 2.271 | 1606 | 30 | 1.500 | 0.147 |
| 58 | Existing Customer | 44 | F | 5 | Graduate | Married | missing | Blue | 35 | 4 | 1 | 2 | 6273.000 | 978 | 5295.000 | 2.275 | 1359 | 25 | 1.083 | 0.156 |
| 658 | Existing Customer | 46 | M | 4 | Graduate | Married | $60K - $80K | Blue | 35 | 5 | 1 | 2 | 1535.000 | 700 | 835.000 | 2.282 | 1848 | 25 | 1.083 | 0.456 |
| 46 | Existing Customer | 56 | M | 2 | Doctorate | Married | $60K - $80K | Blue | 45 | 6 | 2 | 0 | 2283.000 | 1430 | 853.000 | 2.316 | 1741 | 27 | 0.588 | 0.626 |
| 47 | Existing Customer | 59 | M | 1 | Doctorate | Married | $40K - $60K | Blue | 52 | 3 | 2 | 2 | 2548.000 | 2020 | 528.000 | 2.357 | 1719 | 27 | 1.600 | 0.793 |
| 219 | Existing Customer | 44 | F | 3 | Uneducated | Divorced | Less than $40K | Silver | 38 | 4 | 1 | 3 | 11127.000 | 1835 | 9292.000 | 2.368 | 1546 | 25 | 1.273 | 0.165 |
| 2 | Existing Customer | 51 | M | 3 | Graduate | Married | $80K - $120K | Blue | 36 | 4 | 1 | 0 | 3418.000 | 0 | 3418.000 | 2.594 | 1887 | 20 | 1.600 | 0.000 |
| 773 | Existing Customer | 61 | M | 0 | Post-Graduate | Married | missing | Blue | 53 | 6 | 2 | 3 | 14434.000 | 1927 | 12507.000 | 2.675 | 1731 | 32 | 1.600 | 0.134 |
| 8 | Existing Customer | 37 | M | 3 | Uneducated | Single | $60K - $80K | Blue | 36 | 5 | 2 | 0 | 22352.000 | 2517 | 19835.000 | 3.355 | 1350 | 24 | 1.182 | 0.113 |
| 12 | Existing Customer | 56 | M | 1 | College | Single | $80K - $120K | Blue | 36 | 3 | 6 | 0 | 11751.000 | 0 | 11751.000 | 3.397 | 1539 | 17 | 1.600 | 0.000 |
bank["Total_Amt_Chng_Q4_Q1"].clip(upper=1.75, inplace=True)
histogram_boxplot(bank["Avg_Utilization_Ratio"])
# Function that creates barplots with percentage displayed over each category.
# Learned/customized from debrief of Project 1 Cardio Good Fitness
def perc_on_bar(plot, feature):
total = len(feature) # length of the column
for p in ax.patches:
percentage = "{:.1f}%".format(
100 * p.get_height() / total
) # percentage of each class of the category
x = p.get_x() + p.get_width() / 2 - 0.05
y = p.get_y() + p.get_height()
ax.annotate(percentage, (x, y), size=18)
plt.show()
plt.figure(figsize=(25, 15))
ax = sns.countplot(bank["Attrition_Flag"])
perc_on_bar(ax, bank["Attrition_Flag"])
plt.figure(figsize=(25, 15))
ax = sns.countplot(bank["Gender"])
perc_on_bar(ax, bank["Gender"])
plt.figure(figsize=(25, 15))
ax = sns.countplot(bank["Education_Level"])
perc_on_bar(ax, bank["Education_Level"])
plt.figure(figsize=(25, 15))
ax = sns.countplot(bank["Marital_Status"])
perc_on_bar(ax, bank["Marital_Status"])
plt.figure(figsize=(25, 15))
ax = sns.countplot(bank["Income_Category"])
perc_on_bar(ax, bank["Income_Category"])
plt.figure(figsize=(25, 15))
ax = sns.countplot(bank["Card_Category"])
perc_on_bar(ax, bank["Card_Category"])
plt.figure(figsize=(20, 10))
sns.heatmap(bank.corr(), annot=True, vmin=-1, vmax=1, fmt=".2f")
plt.show()
The following are highly correlated:
The following are moderately correlated:
The following are slightly correlated:
sns.pairplot(bank, height=5, hue="Attrition_Flag")
plt.show()